﻿using Engine;
using Engine.Graphics;
using Game;
using Neorxna;
using System;
using System.Collections.Generic;

namespace NekoMeko
{
	public class NekoMekoPlayerModelWidget: PlayerModelWidget
	{
		public Dictionary<string, Matrix> BoneTransforms
		{
			get; set;
		} = [];

		public override void MeasureOverride(Vector2 parentAvailableSize)
		{
			base.MeasureOverride(parentAvailableSize);
			foreach (var model in m_modelWidget.Models)
			{
				foreach (var boneTransform in BoneTransforms)
				{
					var bone = model.FindBone(boneTransform.Key, throwIfNotFound: false);
					if(bone == null)
						continue;
					m_modelWidget.SetBoneTransform(model, bone.Index, boneTransform.Value);
				}
			}
		}
	}
}
